Milestone 2: PHP Backend & REST API

In Progress: April 22

Overview

This milestone demonstrates the PHP backend layer of the Social Media Analytics Dashboard. It includes authentication routes, CRUD endpoints for posts and users, and JSON responses tested against the live MySQL database.

Database Connection


connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
?>
      

Figure 1: PHP connection to MySQL database.

CRUD Endpoints

Operation Endpoint Description
Create /api/create_post.php Insert new post into database.
Read /api/get_posts.php Retrieve posts as JSON.
Update /api/update_post.php Modify existing post content.
Delete /api/delete_post.php Remove post by ID.

Demo Output


{
  "post_id": 1,
  "user_id": 2,
  "content": "First test post!",
  "timestamp": "2026-04-22 14:35:00"
}
      

Figure 2: Sample JSON response from get_posts.php